#!/usr/bin/env make

#######################################################################
#                                                                     #
# Makefile for FBOclass, FBOmanager and sample application.           #
# - Written by Dominik Goeddeke                                       #
#                                                                     #
# Requires gnu-make 3.8.                                              #
#                                                                     #
# Can be used as a starting point for applications developed on top   #
# of this class, just replace the SRC_APPS list below with your own   #
# source files, they will be compiled and linked automatically.       #
#                                                                     #
# Type "make help" for a list of build targets.                       #
#                                                                     #
# Uncomment one of the existing compiler settings below depending on  #
# your installation.                                                  #
#                                                                     #
# Available and tested sections:                                      #
# - GNU C++ compiler ( >= 3.3.5 )                                     # 
# - Intel C++ compiler ( 9.0 )                                        #
#                                                                     #
# See below for user-tunable settings.                                #
#                                                                     #
# Glitches:                                                           #
# - Changes in .h files do not cause recompilation.                   #
#   Workaround: make clean; make                                      #
# - All object files are compiled into the directory they reside in.  #
#                                                                     #
#######################################################################

#
# compiler-specific settings
# change and/or uncomment appropriately

#
# C++ compiler   : CC
# compiler flags : CFLAGS (two different sets for debug and opt mode)
# linker         : LD
# linker flags   : LDFLAGS
#

# GNU C++ compiler
CC	= g++
CFLAGS		= -O3 -I.. -DNDEBUG
#CFLAGS  	= -O0 -I..
LD		= g++
LDFLAGS		= -lGL -lglut -lGLEW

# Intel C++ compiler
#CC		= icpc
#CFLAGS		= -O3 -I.. -DNDEBUG
#CFLAGS		= -O0 -I..
#LD		= icpc
#LDFLAGS	= -lGL -lglut -lGLEW -lGLU

#
# application specific settings
# 
# application binary name
APPNAME	= fbotest
# list of source files for application
SRC_APP = helloGPGPU_GLSL_FBO_Mgr.cpp


#######################################################################
#                                                                     #
#       DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING         #
#                                                                     #
#######################################################################




#
# FBOclass specific settings
#
SRC_FBO	= ../framebufferObject.cpp ../renderbuffer.cpp \
	  ../glErrorUtil.cpp keyedFramebufferObject.cpp

#
# make targets
#

SRCLIST = $(SRC_FBO) $(SRC_APP)
OBJ = $(SRCLIST:%.cpp=%.o)

default: all

help:
	@echo "Available build targets:"
	@echo "help          : this message"
	@echo "all (default) : compile and link"
	@echo "compile       : create obj files"
	@echo "link          : link object files"
	@echo "test          : compile, link and run <$(APPNAME)>"
	@echo "clean         : remove obj files and binary <$(APPNAME)>"

all: compile link

%.o: %.cpp
	$(CC) $(CFLAGS) -o $@ -c $<

compile: $(OBJ)

link: compile
	$(LD) $(LDFLAGS) $(OBJ) -o $(APPNAME)

clean:
	rm -f $(OBJ)
	rm -f $(APPNAME)

test: link
	./$(APPNAME)







